package com.victor.config.properties;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 多数据源的配置
 */
@Component
@ConfigurationProperties(prefix = "biz.datasource")
public class MutiDataSourceProperties {
    /**
     * url
     */
    private String url = "jdbc:mysql://127.0.0.1:3306/biz?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull";
    /**
     * username
     */
    private String username = "root";
    /**
     * password
     */
    private String password = "root";

    /**
     * <b>Description:初始化配置</b><br>
     *
     * @param dataSource
     * @Note <b>Author:</b>zhaojiabin</a>
     * <br><b>Date:</b> 2017年10月18日 上午10:16:06
     * <br><b>Version:</b> 1.0
     */
    public void config(DruidDataSource dataSource) {
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
